<template>
	<view class="order-detail">
		<view class="my-list-detail" v-if="order">
			<view class="ml-item">
				<OrderState :type="2" :stakey="order.status"></OrderState>

				<view class="i-row-title">订单信息
					<template v-if="order.status == 'DRIVER_CONFIRMED'">
						<!-- #ifdef APP-PLUS -->
						<view class="share-btn" @click="shareAppPage">
							<u-icon :name="'share-fill'" :color="'#999'"></u-icon>
						</view>
						<!-- #endif -->

						<!-- #ifndef APP-PLUS || H5 -->
						<view class="share-btn">
							<u-button open-type="share" :custom-style="shareBtnSty">
								<u-icon name="share-fill" color="#999"></u-icon>
							</u-button>
						</view>
						<!-- #endif -->
					</template>
				</view>
				<view class="i-row">
					<view class="r-title">运行车辆：</view>
					<view class="r-it">
						{{order.plateNum?order.plateNum:''}}{{order.carSeats>0?'（'+order.carSeats+'座）':''}}
					</view>
				</view>
				<view class="i-row">
					<view class="r-title">驾驶员：</view>
					<view class="r-it">{{order.driverName?order.driverName :'无主驾'}}
					
					</view>
				</view>
				<view class="i-row">
					<view class="r-title">上车人数：</view>
					<view class="r-it">{{order.personNum > 0 ? order.personNum+'人' : ''}}
					<text style="color: red;">({{order.needSeats+'座'}})</text>
					</view>
					
				</view>

				<!-- 	<view class="i-row">
					<view class="r-title">团上现收：</view>
					<view class="r-it c-red">师傅收客户 {{order.remDriverCharge}} 元</view>
				</view> -->

				<view class="i-row">
					<view class="r-title">出发时间：</view>
					<!-- 	<view class="r-it">{{order.startTime | time('yyyy年MM月dd号 HH:mm')}}</view> -->
					<view class="r-it">{{order.startTime }}</view>
				</view>
				<view v-if="order.isBaitui == 1" class="i-row">
					<view class="r-title">百推订单：</view>
					<view class="r-it c-qgreen" :data-obj="{id: order.id, phone: order.baituiSignatoryPhone}"
						@click="makePhoneCall">{{order.baituiSignatoryPhone }}</view>
				</view>


				<view class="i-row">
					<!-- 	<view class="r-title">客户电话：</view> -->

					<view class="r-it c-qgreen" :data-obj="{id: order.id, phone: order.cusMobile}" </view>

						<view v-for='item in order.persons' class="i-row">
							<view class="r-title">客户电话：</view>
							<view class="r-it c-qgreen" :data-obj="{id: order.id, phone: item.mobile}"
								@click="makePhoneCall">{{item.name}}-{{item.mobile}}</view>
						</view>

						<view class="i-row">
							<view class="r-title">确认驾驶员：</view>
							<view class="r-it">{{order.confirmDriver?order.confirmDriver :'未确认过'}}</view>
						</view>

						<view class="i-row-text">
							<view class="r-title">详情：</view>
							<text :user-select="true">{{order.details}}</text>
							<!-- <text :user-select="true">{{order.routeDetail.replace(/@/g, '\n')}}</text> -->
						</view>
						<view class="i-row-text">
							<view class="r-title">客户备注：</view>
							<text :user-select="true">{{order.remark?order.remark:''}}</text>
							<!-- <text :user-select="true">{{order.routeDetail.replace(/@/g, '\n')}}</text> -->
						</view>
						<view class="i-row-text">
							<view class="r-title">驾驶员备注：</view>
							<text :user-select="true">{{order.driverRemark?order.driverRemark:''}}</text>

						</view>
					</view>

					<view class="ml-item">
						<view class="i-row-title">
							行程导航<label class="r-title-tip">（点击地址直接导航）</label>
						</view>
						<view>
							<u-divider color="#00c3ce" border-color="#00c3ce">
								<!-- {{mp.setime.st | time('yyyy年MM月dd号')}} -->
								{{order.startTime}}
							</u-divider>

							<view class="i-row">
								<u-icon class="r-icon" name="/static/icons/flight-num.png" size="40"></u-icon>
								<view class="r-it">{{order.flightNum ? order.flightNum: '暂无'}}</view>
							</view>

							<view class="i-row" :data-obj="order.fromLocationData" @click="toMapApp">
								<u-icon class="r-icon" name="/static/icons/spoint.png" size="40"></u-icon>
								<view class="r-it">
									{{order.fromLocation}}
									<!-- {{order.fromLocationData.address?order.fromLocationData.address:order.fromLocationData.name}} -->
								</view>
							</view>

							<view v-for="(amit, index) in order.points" :key="amit.id" class="i-row" :data-obj="amit"
								@click="toMapApp">
								<u-icon class="r-icon" name="/static/icons/wpoint.png" size="40"></u-icon>
								<view class="r-it">{{amit.stationName}}</view>
							</view>

							<!-- <view v-if="mp.lunchPoint" class="i-row" :data-obj="mp.lunchPoint" @click="toMapApp">
							<u-icon class="r-icon" name="/static/icons/wpoint.png" size="40"></u-icon>
							<view class="r-it">{{mp.lunchPoint.address}}</view>
						</view>
				
						<view v-for="(pmit, index) in mp.pmps" :key="pmit.id" class="i-row" :data-obj="pmit"
							@click="toMapApp">
							<u-icon class="r-icon" name="/static/icons/wpoint.png" size="40"></u-icon>
							<view class="r-it">{{pmit.address}}</view>
						</view> -->

							<!-- <view v-if="mp.dinnerPoint" class="i-row" :data-obj="mp.dinnerPoint" @click="toMapApp">
							<u-icon class="r-icon" name="/static/icons/wpoint.png" size="40"></u-icon>
							<view class="r-it">{{mp.dinnerPoint.address}}</view>
						</view> -->

							<view class="i-row" :data-obj="order.toLocationData" @click="toMapApp">
								<u-icon class="r-icon" name="/static/icons/epoint.png" size="40"></u-icon>
								<view class="r-it">
									<!-- {{order.toLocationData.address != '[]'?order.toLocationData.address:order.toLocationData.name}} -->
									{{order.toLocation}}
								</view>
							</view>
						</view>
					</view>
					<!-- 老的地图 -->
					<!-- <view v-for="(mp, mpi) in order.dayRoutes" :key="mpi">
					<u-divider color="#00c3ce" border-color="#00c3ce">
						{{mp.setime.st | time('yyyy年MM月dd号')}}
					</u-divider>

					<view class="i-row">
						<u-icon class="r-icon" name="/static/icons/flight-num.png" size="40"></u-icon>
						<view class="r-it">{{mp.staInfo ? mp.staInfo.num : '暂无'}}</view>
					</view>

					<view class="i-row" :data-obj="mp.spoint" @click="toMapApp">
						<u-icon class="r-icon" name="/static/icons/spoint.png" size="40"></u-icon>
						<view class="r-it">{{mp.spoint.address}}</view>
					</view>

					<view v-for="(amit, index) in mp.amps" :key="amit.id" class="i-row" :data-obj="amit"
						@click="toMapApp">
						<u-icon class="r-icon" name="/static/icons/wpoint.png" size="40"></u-icon>
						<view class="r-it">{{amit.address}}</view>
					</view>

					<view v-if="mp.lunchPoint" class="i-row" :data-obj="mp.lunchPoint" @click="toMapApp">
						<u-icon class="r-icon" name="/static/icons/wpoint.png" size="40"></u-icon>
						<view class="r-it">{{mp.lunchPoint.address}}</view>
					</view>

					<view v-for="(pmit, index) in mp.pmps" :key="pmit.id" class="i-row" :data-obj="pmit"
						@click="toMapApp">
						<u-icon class="r-icon" name="/static/icons/wpoint.png" size="40"></u-icon>
						<view class="r-it">{{pmit.address}}</view>
					</view>

					<view v-if="mp.dinnerPoint" class="i-row" :data-obj="mp.dinnerPoint" @click="toMapApp">
						<u-icon class="r-icon" name="/static/icons/wpoint.png" size="40"></u-icon>
						<view class="r-it">{{mp.dinnerPoint.address}}</view>
					</view>

					<view class="i-row" :data-obj="mp.epoint" @click="toMapApp">
						<u-icon class="r-icon" name="/static/icons/epoint.png" size="40"></u-icon>
						<view class="r-it">{{mp.epoint.address}}</view>
					</view>
				</view>
			</view> -->
					<view v-for="(item,index) in order.accidentList" :key="index" class="ml-item">
						<view v-if="item.noticeService">
							<view class="i-row-title" style="display: flex;">
								<view>异常报备</view>
								<view v-if="view_off == 2" style="margin-left: 20rpx;"><u-button
										@click="disposeAccident_btn(item)" size='mini' type="warning">异常报备处理</u-button>
								</view>
							</view>
							<!-- v-if="item.travelDisposeContent != '未处理'" -->
							<view>
								<view class="i-row">
									<view class="r-title">旅行社处理内容：</view>
									<view class="r-it">{{item.travelDisposeContent}}</view>
								</view>
								<view class="i-row">
									<view class="r-title">旅行社处理时间：</view>
									<view class="r-it">{{item.travelDisposeTime}}</view>
								</view>
								<view style="width: 100%;height: 4rpx;background-color: #786e6e94;"></view>
							</view>
							<!-- v-if="item.serviceDisposeContent != '未处理'" -->
							<view>
								<view class="i-row">
									<view class="r-title">调度处理内容：</view>
									<view class="r-it">{{item.serviceDisposeContent}}</view>
								</view>
								<view class="i-row">
									<view class="r-title">调度处理时间：</view>
									<view class="r-it">{{item.serviceDisposeTime}}</view>
								</view>
								<view style="width: 100%;height: 4rpx;background-color: #786e6e94;"></view>
							</view>

							<view class="i-row">
								<view class="r-title">报备名称：</view>
								<view class="r-it">{{item.accidentName}}</view>
							</view>
							<view class="i-row">
								<view class="r-title">报备内容：</view>
								<view class="r-it">{{item.accidentContent}}</view>
							</view>
							<view class="i-row">
								<view class="r-title">报备时间：</view>
								<view class="r-it">{{item.addTime}}</view>
							</view>
							<view class="i-row">
								<view class="r-title">报备备注：</view>
								<view class="r-it">{{item.accidentNote?item.accidentNote:""}}</view>
							</view>
							<view class="i-row">
								<view class="r-title">报备图片：</view>

							</view>
							<view v-if='item.accidentUrl' @click="image_btn( 'https://cba360.com'+item.accidentUrl)"
								style="width: 300rpx;height: 300rpx;">
								<u-image style="width: 300rpx;height: 300rpx;" width="300rpx" height="300rpx"
									:src="'https://cba360.com'+item.accidentUrl"></u-image>
							</view>
						</view>


					</view>
					<view v-if="order.serviceMan" class="ml-item">
						<view class="i-row-title">客户经理</view>
						<view class="i-row">
							<view class="r-title">客户经理：</view>
							<view class="r-it">{{order.serviceMan?order.serviceMan.split('-')[1]:'无'}}</view>
						</view>

						<view class="i-row">
							<view class="r-title">联系电话：</view>
							<view class="r-it c-qgreen"
								:data-obj="{orderNum: order.orderNum,id: order.id, phone: order.serviceMan.split('-')[2]}"
								@click="makePhoneCall">{{order.serviceMan?order.serviceMan.split('-')[2] : '无'}}</view>
						</view>
					</view>

					<view class="ml-item" v-if="order.routeCars.length > 0">
						<view class="i-row-title">同行车辆信息</view>
						<view class="i-row" v-for="(c, index) in order.routeCars" :key="index">
							<view class="r-title">{{c.plateNum}}：</view>
							<view class="r-it c-qgreen" :data-obj="{orderNum: order.orderNum, phone: c.phone}"
								@click="makePhoneCall">{{c.realName}}-{{c.phone}}</view>
						</view>
					</view>

					<view v-if="view_off == 2" class="ml-item">


						<view class="i-row" @click="orderNum_btn(order.orderNum)">
							<view class="r-title">订单编号：</view>
							<view class="r-it c-qgreen">{{order.orderNum?order.orderNum:'无'}}</view>
						</view>
						<view class="i-row">
							<view class="r-title">用车单位：</view>
							<view class="r-it" style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;width:500rpx;">
							{{useCarCompanyId_data_api(order)}}</view>
						</view>
						<view class="i-row" @click="useCarDutyInfo_phone(order)">
							<view class="r-title">用车负责人：</view>
							<view class="r-it">{{useCarDutyInfo_data_api(order)}}
							</view>
						</view>
						<view v-if="order.carCompanyName">
							<view class="i-row">
								<view class="r-title">供车单位：</view>
								<view class="r-it">{{order.carCompanyName}}
								</view>
							</view>
							<view class="i-row" @click="carCompanyName_phone(order)">
								<view class="r-title">供车负责人：</view>
								<view class="r-it">{{
                                    order.carDutyUserInfo ? order.carDutyUserInfo.split('-').length > 2 ?
                                        order.carDutyUserInfo.split('-')[1] + '-' + order.carDutyUserInfo.split('-')[2] :
                                        order.carDutyUserInfo.split('-')[0] + '-' + order.carDutyUserInfo.split('-')[1]
                                        : '' }}
								</view>
							</view>
						</view>

					</view>

				</view>
				<u-mask style="overflow: hidden;" :show="show" @click="show = false">
					<view style="width: 650rpx;height: 650rpx;margin: auto;margin-top: 200rpx;">
						<u-image style="width: 650rpx;height: 650rpx;margin: auto;margin-top: 200rpx;" width="650rpx"
							height="650rpx" :src="imagee"></u-image>
					</view>
				</u-mask>
				<u-popup v-model="disposeAccident_off" mode="center" border-radius="14" closeable='true'>
					<view style="height: 500rpx;width: 500rpx;overflow: hidden;">
						<view style="font-size: 40rpx;font-weight: 700;text-align: center;margin-top: 30rpx;">处理异常报备
						</view>
						<view style="width: 390rpx; margin: auto;margin-top: 30rpx;">
							<u-input v-model="disposeAccident_data" type="textarea" border="true" height="200"
								auto-height="true" />
						</view>
						<view style="width: 200rpx;margin: auto;margin-top: 50rpx;">

							<u-button type="primary" @click="btn_submit">提交</u-button>
						</view>

					</view>
				</u-popup>

				<u-popup v-model="orderNum_btn_off" mode="center" border-radius="14" closeable='true'>
					<view style="width: 700rpx;background-color: #efefef;overflow-y: scroll;">
						<view style="font-size: 40rpx;font-weight: 700;text-align: center;margin-top: 50rpx;">
							订单号：{{order.orderNum?order.orderNum:'无'}}
						</view>
						<view style="padding: 20rpx 30rpx;overflow: auto; ">
							<view
								style="background-color: #fff;padding: 20rpx;border-radius: 8rpx;margin-bottom: 20rpx;"
								v-for="item in orderNum_btn_data">
								<view style="display: flex;">
									<view style="width: 25%;font-size: 30rpx;font-weight: 700;">操作时间：</view>
									<view class="r-it">{{item.addTime}}
									</view>
								</view>
								<view style="display: flex;">
									<view style="width: 25%;font-size: 30rpx;font-weight: 700;">操作人：</view>
									<view class="r-it">{{item.operUserId}}
									</view>
								</view>
								<view style="display: flex;">
									<view style="width: 25%;font-size: 30rpx;font-weight: 700;">操作状态：</view>
									<view class="r-it">{{item.status?item.status:''}}
									</view>
								</view>
								<view @click="operNote_btn(item.operNote)" style="display: flex;">
									<view style="width: 25%;font-size: 30rpx;font-weight: 700;">操作备注：</view>
									<view
										style="color:#00c3ce; white-space: nowrap;overflow: hidden;text-overflow: ellipsis;width: 70%;">
										{{item.operNote?item.operNote:''}}
									</view>
								</view>
							</view>

						</view>

					</view>
				</u-popup>
				<u-toast ref="uToast" />
			</view>
</template>

<script>
	//#ifdef APP-PLUS
	import uniShare from '@/uni_modules/uni-share/js_sdk/uni-share.js';
	//#endif

	import OrderState from '@/components/order-state/order-state.vue';

	export default {
		components: {
			OrderState
		},
		data() {
			return {

				orderNum_btn_off: false,
				orderNum_btn_data: {},
				id: '',
				view_off: 0,
				imagee: "",
				show: false,
				disposeAccident_obj: {},
				disposeAccident_off: false,
				disposeAccident_data: '',
				// 订单详情
				order: null,
				// 分享按钮样式
				shareBtnSty: {
					'width': '30rpx',
					'height': '30rpx',
					'padding': '0rpx',
					'color': '#ffffff'
				},
			}
		},
		onShow() {

			// #ifdef MP-WEIXIN
			// 隐藏返回首页按钮
			// uni.hideHomeButton();
			// #endif

		},
		onLoad(ps) {
			const that = this,
				U = that.U;
			// console.log('传入的参数', ps);
			that.view_off = 0
			that.id = ps.id
			let lrole = uni.getStorageSync('lrole');
			if (lrole.roleName == '驾驶员') {
				that.view_off = 1
			} else {
				that.view_off = 2
			}
			that.getOrderDetail(ps.id);
		},
		methods: {
			operNote_btn(e) {
				if (e) {
					this.$refs.uToast.show({
						title: e,
						type: 'warning',
						icon: false,
						duration: '3000',
					})
				}


			},
			orderNum_btn(e) {
				let that = this
				let ps = {
					page: {
						pageNum: 1,
						pageSize: 999,
					},
					orderNum: e,
				}
				that.$u.api.findOrderScheduleByOrderNum(ps).then(res => {
					if (res.code == 1) {
						that.orderNum_btn_data = res.data.list

						that.orderNum_btn_off = true
					} else {
						return uni.showToast({
							title: res.msg,
							duration: 2000,
							icon: 'none',
						});
					}
				});



			},
			useCarDutyInfo_phone(e) {

				if (e.useCarDutyInfo) {
					let phone = e.useCarDutyInfo.split('-')[1]
					uni.makePhoneCall({
						phoneNumber: phone,
						success: () => {


							let ps = {
								orderNum: e.orderNum,
								phone: phone
							};
							that.$u.api.driverCallCus(ps).then(res => {
								if (res.code == 1) {

								}
							});
						}
					});
				} else {
					return uni.showToast({
						title: '电话号码无效',
						duration: 2000,
						icon: 'none',
					});
				}


			},
			carCompanyName_phone(e) {

				if (e.carDutyUserInfo) {
					if (e.carDutyUserInfo.split('-').length > 2) {
						let phone = e.carDutyUserInfo.split('-')[2]
						uni.makePhoneCall({
							phoneNumber: phone,
							success: () => {


								let ps = {
									orderNum: e.orderNum,
									phone: phone
								};
								that.$u.api.driverCallCus(ps).then(res => {
									if (res.code == 1) {

									}
								});
							}
						});
					} else {
						let phone = e.carDutyUserInfo.split('-')[1]
						uni.makePhoneCall({
							phoneNumber: phone,
							success: () => {
						
						
								let ps = {
									orderNum: e.orderNum,
									phone: phone
								};
								that.$u.api.driverCallCus(ps).then(res => {
									if (res.code == 1) {
						
									}
								});
							}
						});
					}

				} else {
					return uni.showToast({
						title: '电话号码无效',
						duration: 2000,
						icon: 'none',
					});
				}


			},
			useCarDutyInfo_data_api(e) {
				let data = ''
				if (e.isCompanyCustomer == 1) {

					if (e.virtuallyUseCarInfo) {
						let realName = e.realName ? e.realName : '匿名'
						let mobile = e.mobile ? e.mobile : ''
						data = e.virtuallyUseCarInfo.split('-')[0] + '(' + e.useCarDutyInfo + ')'
					} else {
						let realName = e.realName ? e.realName : '匿名'
						let mobile = e.mobile ? e.mobile : ''
						data = e.useCarDutyInfo
					}

				} else if (e.isCompanyCustomer == 0 && e.companyNum == '8112010001') {

					if (e.virtuallyUseCarInfo) {
						let realName = e.realName ? e.realName : '匿名'
						let mobile = e.mobile ? e.mobile : ''
						data = e.virtuallyUseCarInfo.split('-')[0] + '(' + e.useCarDutyInfo + ')'
					} else {
						let realName = e.realName ? e.realName : '匿名'
						let mobile = e.mobile ? e.mobile : ''
						data = e.useCarDutyInfo
					}
				} else if (e.isCompanyCustomer == 0 && e.companyNum != '8112010001') {
					data = e.virtuallyUseCarInfo ? e.virtuallyUseCarInfo.split('-')[0] : '匿名'
				}


				return data
			},
			useCarCompanyId_data_api(e) {
				let data = ''
				if (e.isCompanyCustomer == 1) {
					if (e.virtuallyUseCarInfo) {
						let data2 = ''
						if (e.useCarCompanyName) {
							data2 = e.useCarCompanyName ? e.useCarCompanyName : '匿名'
						} else {
							data2 = e.realName ? e.realName : '匿名'
						}
						data = e.virtuallyUseCarInfo.split('-')[0] + '【' + data2 + '】'
					} else {

						if (e.useCarCompanyName) {
							data = e.useCarCompanyName ? e.useCarCompanyName : '匿名'
						} else {
							data = e.realName ? e.realName : '匿名'
						}

					}
				} else if (e.isCompanyCustomer == 0 && e.companyNum == '8112010001') {
					if (e.virtuallyUseCarInfo) {
						let data2 = ''
						if (e.useCarCompanyName) {
							data2 = e.useCarCompanyName ? e.useCarCompanyName : '匿名'
						} else {
							data2 = e.realName ? e.realName : '匿名'
						}
						data = e.virtuallyUseCarInfo.split('-')[0] + '【' + data2 + '】'
					} else {

						if (e.useCarCompanyName) {
							data = e.useCarCompanyName ? e.useCarCompanyName : '匿名'
						} else {
							data = e.realName ? e.realName : '匿名'
						}

					}
				} else if (e.isCompanyCustomer == 0 && e.companyNum != '8112010001') {
					if (e.virtuallyUseCarInfo) {
						data = e.virtuallyUseCarInfo.split('-')[0] ? e.virtuallyUseCarInfo : '匿名'
					} else {
						data = ''
					}

				}


				return data
			},
			btn_submit() {
				let that = this
				let ps = {
					accidentIndex: that.disposeAccident_obj.accidentIndex,
					id: that.id,
					disposeAccidentContent: that.disposeAccident_data,

				}
				that.$u.api.disposeAccident(ps).then(res => {
					if (res.code == 1) {
						this.disposeAccident_off = false
						that.getOrderDetail(that.id);
						return uni.showToast({
							title: res.msg,
							duration: 2000,
							icon: 'none',
						});
					} else {
						return uni.showToast({
							title: res.msg,
							duration: 2000,
							icon: 'none',
						});
					}
				});
			},
			disposeAccident_btn(e) {
				this.disposeAccident_obj = e
				this.disposeAccident_data = e.serviceDisposeContent
				this.disposeAccident_off = true
				console.log(e)
			},
			image_btn(e) {
				this.show = true
				this.imagee = e

			},
			// 获取-订单详情
			getOrderDetail(id) {
				const that = this,
					U = that.U;

				that.$u.api.getOrderDetail({
					id: id
				}).then(res => {
					if (res.code == 1) {
						that.order = res.data;
						console.log(that.order)

						if (that.order.cusInfo) {

							let cusInfo = that.order.cusInfo.split(',')
							// let cusInfo_index = cusInfo.shift()

							that.order.cusName = cusInfo[0].split('-')[0]
							that.order.cusMobile = cusInfo[0].split('-')[1]
							let arr_persons = []
							for (let i = 0; i < cusInfo.length; i++) {
								let cusInfo_data = {
									name: '',
									mobile: '',
								}
								cusInfo_data.name = cusInfo[i].split('-')[0]
								cusInfo_data.mobile = cusInfo[i].split('-')[1]
								arr_persons.push(cusInfo_data)


							}
							that.order.persons = arr_persons
							console.log(that.order.persons, 'that.order.persons')
						}

						// console.log(res.data)
						// that.shareMpPage();
						// 初始化分享（只有已确认的行程才能分享）
						// if(that.order && that.order.status.key == 'DRIVER_CONFIRMED'){
						// that.shareMpPage();
						// }
					}
				});
			},
			// 分享小程序页面
			shareMpPage() {
				const that = this,
					obj = that.order;

				//#ifdef MP
				// 小程序-分享
				that.$u.mpShare = {
					// 默认为小程序名称，可自定义
					title: obj.routeSimpleName,
					// 默认为当前页面路径，一般无需修改，QQ小程序不支持
					// path: '', 
					// 分享图标，路径可以是本地文件路径、代码包文件路径或者网络图片路径。
					// 支持PNG及JPG，默认为当前页面的截图
					// imageUrl: '' 
				}
				//#endif
			},
			// 分享APP页面
			shareAppPage() {
				const that = this,
					obj = that.order;

				//#ifdef APP-PLUS
				uniShare({
					content: { //公共的分享参数配置  类型（type）、链接（herf）、标题（title）、summary（描述）、imageUrl（缩略图）
						type: 0,
						href: `${that.C.baseUrl}`,
						title: obj.routeSimpleName,
						summary: obj.routeDetail.replace(/@/g, '\n'),
						imageUrl: `${that.C.staticNetUrl}/share-logo.png`
					},
					menus: [{
							"img": `${that.C.staticNetUrl}/wechatfriend.png`,
							"text": "微信好友",
							"share": { //当前项的分享参数配置。可覆盖公共的配置如下：分享到微信小程序，配置了type=5
								"provider": "weixin",
								"scene": "WXSceneSession"
							}
						},
						{
							"img": `${that.C.staticNetUrl}/wechatmoments.png`,
							"text": "微信朋友圈",
							"share": {
								"provider": "weixin",
								"scene": "WXSenceTimeline"
							}
						},
						{
							"img": `${that.C.staticNetUrl}/mp_weixin.png`,
							"text": "微信小程序",
							"share": {
								provider: "weixin",
								scene: "WXSceneSession",
								type: 5,
								miniProgram: {
									id: 'gh_7f93ecac1bff',
									path: '/order-man/order-detail/order-detail?orderNum=' + obj.orderNum,
									webUrl: `${that.C.baseUrl}/mb/wxAuthority?tno=${obj.unitNum}&wr=TEAM_DRIVER&state=114`,
									type: 0
								},
							}
						},
						// {
						// 	"img": `${that.C.staticNetUrl}/share_more.png`,
						// 	"text": "更多",
						// 	"share": "shareSystem"
						// }
					],
					cancelText: "取消分享",
				}, e => { //callback
					console.log(e);
				})
				//#endif
			},
			// 拨打电话
			makePhoneCall(e) {
				let that = this,
					U = that.U,
					obj = e.currentTarget.dataset.obj;

				let phone = U.trim(obj.phone, 'all');
				uni.makePhoneCall({
					phoneNumber: phone,
					success: () => {
						console.log("成功拨打电话")

						let ps = {
							orderNum: obj.orderNum,
							phone: phone
						};
						that.$u.api.driverCallCus(ps).then(res => {
							if (res.code == 1) {
								console.log("拨打记录成功");
							}
						});
					}
				});
			},
			// 调起第三方地图导航
			toMapApp(event) {
				const that = this,
					U = that.U,
					p = event.currentTarget.dataset.obj;
				console.log('当前点击点', p);

				// 起点：经度,纬度
				let lat = p.lnglat.split(',')[1];
				let lng = p.lnglat.split(',')[0];
				let address = p.address ? p.address : p.name;
				let name = p.address ? p.address : p.name;
				// let name = address.split(' ')[1];

				U.toMapMp(lat, lng, name, address);

				// //#ifdef APP-PLUS
				// U.toMapApp(lat, lng, name);
				// //#endif
			},
		}
	}
</script>

<style lang="less">
	.order-detail {
		/* #ifdef MP-WEIXIN */
		height: 100vh;
		overflow-y: auto;
		/* #endif */

		background: #efefef;
		padding: 20rpx;
	}
</style>